<?
$_static_value = array();
class StaticValue {

    /*
     * Lấy ra mảng city trong bảng cities
     */
    static function ComboBox_LoadCity(){
        global $_static_value;
        if(isset($_static_value['ComboBox_LoadCity'])){
            return $_static_value['ComboBox_LoadCity'];
        }else{
            $array_temp = array(''=>'- Chọn thành phố -');
            $db = new db_query('SELECT cit_id, cit_name FROM cities');
            while($row = mysql_fetch_assoc($db->result)){
                $array_temp[$row['cit_id']] = $row['cit_name'];
            }
            $_static_value['ComboBox_LoadCity'] = $array_temp;
            return $array_temp;
        }
    }
    static function ComboBox_LoadState($cit_id = ''){
        global $_static_value;
        if(isset($_static_value['ComboBox_LoadState'])){
            return $_static_value['ComboBox_LoadState'];
        }else{
            $array_temp = array(''=>'- Chọn quận huyện -');
            if(!$cit_id)
                $db = new db_query('SELECT dis_id, dis_name FROM districts');
            else
                $db = new db_query('SELECT dis_id, dis_name FROM districts WHERE dis_city_id = '.$cit_id);
            while($row = mysql_fetch_assoc($db->result)){
                $array_temp[$row['dis_id']] = $row['dis_name'];
            }
            $_static_value['ComboBox_LoadState'] = $array_temp;
            return $array_temp;
        }
    }
}